import Vue from "vue";
import VueRouter from "vue-router";
// import dynamicRoutes from './dynamicRoutes'
Vue.use(VueRouter);

//解决路由导航到统一路径重复报错的问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const routes = [

  // 登录页路由
  {
    path: "/login",
    name: "Login",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "login" */ "../pages/login"),
  },
  // ...dynamicRoutes //此处必须要展开，是因为dynamicRoutes是一个数组，只有展开才行
];

const router = new VueRouter({
  routes,
});

export default router;
